/* =========================================================
   Collections Page (Dyson-inspired shelves)
   Mobile-first, Apple-like rounded cards
   ========================================================= */

/* Apple-like typography (scoped to Collections only) */
#collectionsContainer,
#specialtyContainer {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.collections-container {
  padding: 10px var(--space-4, 16px);
  padding-bottom: calc(var(--space-6, 24px) + 88px); /* keep above bottom nav */
  box-sizing: border-box;
}

/* Filters row (Category chips) */
.collections-filters {
  margin: 6px 0 10px;
}

.collections-chips {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
}

.collections-chips::-webkit-scrollbar {
  display: none;
}

.collections-chip {
  appearance: none;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary, #111827);
  font-size: 13px;
  font-weight: 650;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.06);
  touch-action: manipulation;
  white-space: nowrap;
}

.collections-chip:active {
  transform: translateY(0.5px);
}

.collections-chip-active {
  background: rgba(70, 146, 145, 0.14);
  border-color: rgba(70, 146, 145, 0.35);
  color: #0f3f3e;
}

.collections-category {
  margin-top: 10px;
}

.collections-category-title {
  margin: 0 0 var(--space-3, 12px);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
}

.collections-shelf {
  margin-bottom: var(--space-5, 20px);
}

.collections-shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  margin-bottom: var(--space-3, 12px);
}

.collections-shelf-brand {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-primary, #111827);
  margin: 0;
}

.collections-shelf-action {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-teal, #469291);
  font-weight: 650;
  font-size: 14px;
  padding: 10px 10px;
  min-height: 44px;
  border-radius: 12px;
  touch-action: manipulation;
}

.collections-shelf-action:active {
  background: rgba(70, 146, 145, 0.10);
}

.collections-row {
  display: grid;
  grid-auto-flow: column;
  /* 2 full cards + a subtle peek of the 3rd (Dyson-style) */
  grid-auto-columns: clamp(176px, 44vw, 220px);
  gap: 12px;
  overflow-x: auto;
  padding-right: 14px; /* creates the “peek” affordance */
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.collections-row::-webkit-scrollbar {
  display: none;
}

.collections-card {
  scroll-snap-align: start;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow:
    0 10px 24px rgba(17, 24, 39, 0.08),
    0 1px 0 rgba(17, 24, 39, 0.04);
  overflow: hidden;
  touch-action: manipulation;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.collections-card-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.collections-card-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, rgba(70,146,145,0.18), rgba(244,192,60,0.14));
  position: relative;
  overflow: hidden;
}

.collections-badge {
  position: absolute;
  top: 10px;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(17, 24, 39, 0.88);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
  pointer-events: none; /* don't steal taps from the card */
}

.collections-badge-price {
  left: 10px;
}

.collections-badge-low {
  right: 10px;
  padding: 6px 9px;
  color: rgba(120, 53, 15, 0.95);
  background: rgba(244, 192, 60, 0.40);
  border-color: rgba(244, 192, 60, 0.55);
}

.collections-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.collections-card-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: rgba(17, 24, 39, 0.55);
}

.collections-card-body {
  padding: 12px 12px 8px;
}

.collections-card-name {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-primary, #111827);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.collections-card-sub {
  margin: 0;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-muted, #6b7280);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 16px;
}

.collections-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted, #6b7280);
}

.collections-card-price {
  color: var(--text-primary, #111827);
}

.collections-card-footer {
  margin-top: auto;
  padding: 10px 12px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(74, 74, 74, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative; /* for low-pill positioning */
}

.collections-low-pill {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  line-height: 1;
  color: rgba(120, 53, 15, 0.95);
  background: rgba(244, 192, 60, 0.40);
  border: 1px solid rgba(244, 192, 60, 0.55);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
  pointer-events: none;
}

.collections-card-qty {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Stock legend under search bar */
.collections-stock-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 0 2px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  font-weight: 650;
}

.collections-legend-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  color: rgba(120, 53, 15, 0.95);
  background: rgba(244, 192, 60, 0.40);
  border: 1px solid rgba(244, 192, 60, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
}

.collections-stock-legend-text {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-muted, #6b7280);
}

.collections-showall-flat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 2px 12px;
}

.collections-showall-flat-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary, #111827);
  letter-spacing: -0.01em;
}

.collections-showall-flat-sub {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-muted, #6b7280);
}

.collections-card-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.collections-card-stock {
  font-size: 12px;
  font-weight: 900;
  color: var(--text-muted, #6b7280);
}

.collections-card-meta-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* When item is in cart, hide price to make room for full (- qty +) */
.collections-card.has-qty .collections-card-price,
.collections-grid-card.has-qty .collections-card-price {
  display: none;
}

.collections-card-meta-right .circular-qty-control {
  transform: scale(0.92);
  transform-origin: center right;
}

.collections-skeleton {
  animation: collectionsShimmer 1.2s infinite linear;
  background: linear-gradient(90deg, rgba(17,24,39,0.06), rgba(17,24,39,0.10), rgba(17,24,39,0.06));
  background-size: 200% 100%;
}

@keyframes collectionsShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.collections-empty {
  margin-top: 24px;
  padding: 18px 14px;
  border-radius: 16px;
  background: rgba(17, 24, 39, 0.04);
  color: var(--text-muted, #6b7280);
  font-weight: 700;
}

/* ---------------------------------------------------------
   Collections Update Mode (maintenance-style placeholder)
   --------------------------------------------------------- */
.collections-update-wrap {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 12px 28px;
  border-radius: 18px;
  background:
    radial-gradient(1200px 500px at 20% 10%, rgba(70,146,145,0.28), transparent 55%),
    radial-gradient(900px 420px at 80% 30%, rgba(244,192,60,0.18), transparent 55%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.01));
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
  position: relative;
  overflow: hidden;
}

.collections-update-wrap::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-30%) rotate(10deg);
  animation: collectionsUpdateSheen 4.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes collectionsUpdateSheen {
  0% { transform: translateX(-35%) rotate(10deg); opacity: 0.25; }
  50% { transform: translateX(35%) rotate(10deg); opacity: 0.45; }
  100% { transform: translateX(-35%) rotate(10deg); opacity: 0.25; }
}

.collections-update-tile {
  width: min(520px, 100%);
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 18px;
  padding: 18px 16px 16px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.12);
  position: relative;
}

.collections-update-glyph {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, rgba(70,146,145,0.22), rgba(244,192,60,0.14));
  border: 1px solid rgba(17, 24, 39, 0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
  animation: collectionsUpdateBreath 2.8s ease-in-out infinite;
}

@keyframes collectionsUpdateBreath {
  0%, 100% { transform: translateY(0); filter: saturate(1); }
  50% { transform: translateY(-2px); filter: saturate(1.08); }
}

.collections-update-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.collections-update-sub {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.62);
  line-height: 1.45;
}

.collections-update-dots {
  display: inline-flex;
  gap: 6px;
  margin-top: 12px;
}

.collections-update-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(70,146,145,0.55);
  animation: collectionsUpdateDots 1.2s ease-in-out infinite;
}
.collections-update-dots span:nth-child(2) { animation-delay: 0.15s; opacity: 0.9; }
.collections-update-dots span:nth-child(3) { animation-delay: 0.3s; opacity: 0.8; }

@keyframes collectionsUpdateDots {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-4px); opacity: 0.95; }
}

/* Global search: compact "Collections" toggle (shown on Collections tab) */
.collections-only-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(17, 24, 39, 0.10);
  flex-shrink: 0;
}

.collections-only-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
}

.collections-only-switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
}

.collections-only-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.collections-only-slider {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.18);
  border-radius: 999px;
  transition: background 0.18s ease;
}

.collections-only-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.20);
  transition: transform 0.18s ease;
}

.collections-only-switch input:checked + .collections-only-slider {
  background: rgba(70, 146, 145, 0.55);
}

.collections-only-switch input:checked + .collections-only-slider::before {
  transform: translateX(16px);
}

/* Brand "See all" (inline view under existing header + search) */
.collections-brand-inline {
  padding-bottom: 16px;
}

.collections-brand-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.collections-brand-back-inline {
  appearance: none;
  border: 0;
  background: rgba(70, 146, 145, 0.12);
  color: #0f3f3e;
  font-weight: 900;
  font-size: 13px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 12px;
  touch-action: manipulation;
}

.collections-brand-inline-title {
  flex: 1;
  text-align: center;
}

.collections-brand-inline-name {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary, #111827);
}

.collections-brand-inline-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted, #6b7280);
}

.collections-brand-sections {
  margin-top: 12px;
}

.collections-brand-type-label {
  margin: 18px 0 10px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Show-all grid: keep cards compact on desktop (otherwise 2 columns gets huge) */
.collections-showall-flat .collections-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

@media (min-width: 1100px) {
  .collections-showall-flat .collections-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.collections-grid-card {
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow:
    0 10px 24px rgba(17, 24, 39, 0.08),
    0 1px 0 rgba(17, 24, 39, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* "Show all" classic view */
.collections-showall {
  padding-bottom: 16px;
}

.collections-showall-category {
  margin-top: 12px;
}

.collections-showall-category-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
}

.collections-showall-brand {
  margin-bottom: 18px;
}

.collections-showall-brand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.collections-showall-brand-name {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: var(--text-primary, #111827);
  letter-spacing: -0.02em;
}

.collections-showall-type {
  margin-top: 12px;
}

.collections-showall-type-label {
  margin: 12px 0 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
}

